function numberOfSteps(num: number): number {
    let count: number = getCount(num,0)
    return count
};

function getCount(num:number, count:number): number{
    if(num === 0){
        return count
    }else if(num%2 === 0){
        return getCount(num/2,++count)
    }else {
        return getCount(--num,++count)
    }
}

console.log(numberOfSteps(123))